package com.masterclient.app.businessmodule.homemodule.presenter.timetask;

import com.eoner.baselibrary.base.IBaseFragment;
import com.masterclient.app.businessmodule.homemodule.presenter.timetask.base.HomeBaseTimerTask;
import com.masterclient.app.businessmodule.homemodule.presenter.timetask.search.HomeSearchWordTimerTask;
import com.masterclient.app.businessmodule.homemodule.presenter.timetask.xshop.HomeXShopTimerTask;
import com.masterclient.app.businessmodule.homemodule.view.IHomeMainView;

import java.util.List;

/**
* 首页定时任务
* */
public class HomeTimerTask extends HomeBaseTimerTask<HomeTimerTask> implements IHomeTimerTask {

    private HomeSearchWordTimerTask mHomeSearchWordTimerTask;
    private HomeXShopTimerTask mHomeXShopTimerTask;

    @Override
    public HomeTimerTask bindViewAndInteraction(IHomeMainView iHomeMainView, IBaseFragment iBaseFragment) {
        mHomeSearchWordTimerTask = new HomeSearchWordTimerTask().bindViewAndInteraction(iHomeMainView,iBaseFragment);
        mHomeXShopTimerTask = new HomeXShopTimerTask().bindViewAndInteraction(iHomeMainView,iBaseFragment);
        return super.bindViewAndInteraction(iHomeMainView, iBaseFragment);
    }

    @Override
    public void executeHomeSearchTimerTask(List<String> searchTermKeyword, int cycleTime) {
        if (mHomeSearchWordTimerTask != null) {
            mHomeSearchWordTimerTask.executeHomeSearchTimerTask(searchTermKeyword,cycleTime);
        }
    }

    @Override
    public void stopSearchTimerTask() {
        if (mHomeSearchWordTimerTask != null) {
            mHomeSearchWordTimerTask.stopTimerTask();
        }
    }

    @Override
    public void stopXShopTimerTask() {
        if (mHomeXShopTimerTask != null) {
            mHomeXShopTimerTask.stopTimerTask();
        }
    }

}
